using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Spinning.Spinning.EntityModifiers;

namespace Spinning.Spinning.Unitity.EntityModifiers
{
    class RotationModifier : SingleValueModifier
    {
        public RotationModifier(int startTime, int endTime, float from, float to)
            : base(startTime, endTime,from,to) { }

        protected override void onStart(Interface.IEntity item, EntityModifier modifier)
        {
            item.Rotation = _from;
        }

        protected override void onFinish(Interface.IEntity item, EntityModifier modifier)
        {
            item.Rotation = _to;
        }

        protected override void uptateEntity(Interface.IEntity item, float frames, int count)
        {
            float displacement = (_to - _from) / frames;
            item.Rotation = _from + displacement * count;
        }
    }
}
